package com.dex4d.ui.mine.activity;

import android.os.Bundle;
import android.view.View;

import com.dex4d.R;
import com.dex4d.core.AppToolBarBaseActivity;
import com.dex4d.model.User;
import com.dex4d.utils.Commons;
import com.dex4d.widgets.SimpleListItem;

import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

import static com.dex4d.utils.Commons.BUNDLE_KEYS.TO_KEYSTORE;
import static com.dex4d.utils.Commons.BUNDLE_KEYS.TO_MNEMONIC;

/**
 * Created by chengyuchun on 2018/11/2.
 */
public class SettingSecurityActivity extends AppToolBarBaseActivity {

    @BindView(R.id.sli_check_mnemonic)
    SimpleListItem sli_check_mnemonic;

    @BindView(R.id.sli_backup_keystore)
    SimpleListItem sli_backup_keystore;

    @Override
    protected void initToolbar() {
        showTitle(getString(R.string.security));
        showBackView();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_setting_security;
    }

    @Override
    protected void initVariables() {
        List<String> mnemonicList =  User.getInstance().getMnemonic();
        if(mnemonicList == null || mnemonicList.size() == 0){
            sli_check_mnemonic.setVisibility(View.GONE);
        }else {
            sli_check_mnemonic.setVisibility(View.VISIBLE);
        }
    }

    @Override
    protected void loadData() {

    }

    @OnClick({R.id.sli_check_mnemonic,R.id.sli_backup_keystore})
    public void onViewClick(View view){
        Bundle bundle = new Bundle();
        switch (view.getId()) {
            case R.id.sli_check_mnemonic:
                bundle.putString(Commons.BUNDLE_KEYS.TO_TARGET,TO_MNEMONIC);
                openActivity(CheckPinActivity.class,bundle);
                break;
            case R.id.sli_backup_keystore:
                bundle.putString(Commons.BUNDLE_KEYS.TO_TARGET,TO_KEYSTORE);
                openActivity(CheckPinActivity.class,bundle);
                break;
        }
    }
}
